Choose Folder
The Choose Folder command displays a dialog box like the one in Figure 2-3 to allow the user to choose a directory (that is, a folder, a volume, or the desktop).Figure 2-3 A Choose Folder dialog box
The Choose Folder command is one of two commands provided by the Choose File scripting addition.
SYNTAX
choose folder [ with prompt promptString ]PARAMETERS
- promptString
- The prompt that appears in the dialog box. The prompt can be up to 255 characters long, but the standard dialog box has room for only about 80 characters. If you omit the
with prompt
parameter, the string"Choose a folder:"
is displayed.
Class: String
Default Value:"Choose a folder:"
RESULT
A reference of the formfile
"Disk:Folder1:Folder2:...:Foldername"
for the directory specified by the user, if any.EXAMPLE
choose folder with prompt "Choose a folder or volume:"NOTES
If the user clicks Cancel in the Choose Folder dialog box, AppleScript returns error number -128. If you want your script to continue after the user clicks Cancel, you must include an error handler. For information about Try statements and error handlers, see Chapter 7, "Control Statements," in the AppleScript Language Guide.ERRORS
Error
numberError message -108 Out of memory. -128 User canceled.